<include file="public@header"/>
</head>
<body>
<div class="wrap js-check-wrap">
    <ul class="nav nav-tabs">
        <li class="active"><a href="drugstorelist">药店列表</a></li>
        <li><a href="drugstoreadd">药店添加</a></li>
    </ul>
    <form class="well form-inline margin-top-20" method="get" action="">
        分类:
        <select class="form-control" name="category" style="width: 140px;">
            <option value=''>全部</option>
            <option value='0'>未审核</option>
            <option value='1'>已通过</option>
            <option value='2'>未通过</option>

        </select> &nbsp;&nbsp;
        关键字:
        <input type="text" class="form-control" name="keyword" style="width: 200px;"
               value="" placeholder="请输入关键字...">
        <input type="submit" class="btn btn-primary" value="搜索"/>
    </form>

    <form method="post" class="js-ajax-form" action="">
        <!-- <div class="table-actions">
             <button type="submit" class="btn btn-primary btn-sm js-ajax-submit">{:lang('SORT')}</button>
             <button class="btn btn-primary btn-sm js-ajax-submit" type="submit"
                     data-action="{:url('AdminCategory/toggle',array('display'=>'1'))}" data-subcheck="true">
                 {:lang('DISPLAY')}
             </button>
             <button class="btn btn-primary btn-sm js-ajax-submit" type="submit"
                     data-action="{:url('AdminCategory/toggle',array('hide'=>1))}" data-subcheck="true">{:lang('HIDE')}
             </button>
         </div>-->

        <table class="table table-hover table-bordered table-list" id="menus-table">
            <thead>
                <tr>
                    <th width="30">ID</th>
                    <th width="50">药店名称</th>
                    <th width="50">药店分类</th>
                    <th width="50">药店地址</th>
                    <th width="50">药店详细地址</th>
                    <th width="50">营业执照</th>
                    <th width="50">经营许可证</th>
                    <th width="50">审核</th>
                    <th width="50">操作</th>
                </tr>
            </thead>
            <tfoot>
                <tr>
                    <foreach name="res" item="res">
                <tr>
                    <th width="30">{$res['id']}</th>
                    <td width="50">{$res['shopname']}</td>
                    <td width="50">{$res['shoplevel']}</td>
                    <td width="50">{$res['province']}{$res['city']}{$res['district']}</td>
                    <td width="50">{$res['xcity']}</td>
                    <td width="50"><img src="http://www.youyi.com/{$res['openimages']}" alt=""></td>
                    <td width="50"><img src="http://www.youyi.com/{$res['licenceimages']}" alt=""></td>
                    <td width="50">
                        <if condition="$res['status']== 1">
                            <span class="label label-danger">未审核</span>
                            <elseif condition="$res['status']== 2 "/>
                            <span class="label label-success">已通过</span>
                            <elseif condition="$res['status']== 3 "/>
                            <span class="label label-warning">未通过</span>
                        </if>
                    </td>
                    <td width="50">
                        <a class="btn btn-xs btn-danger js-ajax-delete" class="" href="{:url('Drugstore/Drugstoredelete',array('id'=>$res['id']))}">删除</a>
                        <a class="btn btn-xs btn-primary" href="{:url('Drugstore/Drugstoreupdate',array('id'=>$res['id']))}">修改</a>
                    </td>
                </tr>
                </foreach>
                </tr>
            </tfoot>
        </table>
    </form>
</div>
<script src="__STATIC__/js/admin.js"></script>
<script src="__STATIC__/js/jquery.js"></script>
<script>
    $(function(){
        $(".btn-primary").click(function(){

        })

    })





    $(document).ready(function () {
        Wind.css('treeTable');
        Wind.use('treeTable', function () {
            $("#menus-table").treeTable({
                indent: 20,
                initialState: 'expanded'
            });
        });
    });

    // $(' #menus-table .js-check').change(function () {
    //     console.log('change');
    //     checkNode(this);
    // });
    //
    // function checkNode(obj) {
    //     var $obj   = $(obj);
    //     var $table = $obj.parents('table');
    //
    //     var id       = $obj.data('id');
    //     var parentId = $obj.data('parent_id');
    //
    //     function checkParent(id, parentId, checked) {
    //         console.log('checkParent:' + id);
    //         var $parent = $("tr [data-id='" + parentId + "']", $table);
    //         if ($parent.length > 0) {
    //             $parent.prop("checked", checked);
    //             checkParent($parent.data('id'), $parent.data('parent_id'), checked);
    //         }
    //     }
    //
    //     function checkChild(id, parentId, checked) {
    //         console.log('checkChild:' + id);
    //         var $child = $("tr [data-parent_id='" + id + "']", $table);
    //
    //         if ($child.length > 0) {
    //             $child.prop("checked", checked);
    //             checkChild($child.data('id'), $child.data('parent_id'), checked);
    //         }
    //     }
    //
    //     if ($obj.is(':checked')) {
    //         checkParent(id, parentId, true);
    //         checkChild(id, parentId, true);
    //     } else {
    //         checkParent(id, parentId, false);
    //         checkChild(id, parentId, false);
    //     }
    //     return;
    //     var chk   = $("input[type='checkbox']");
    //     var count = chk.length;
    //
    //     var num       = chk.index(obj);
    //     var level_top = level_bottom = chk.eq(num).attr('level');
    //     for (var i = num; i >= 0; i--) {
    //         var le = chk.eq(i).attr('level');
    //         if (le < level_top) {
    //             chk.eq(i).prop("checked", true);
    //             var level_top = level_top - 1;
    //         }
    //     }
    //     for (var j = num + 1; j < count; j++) {
    //         var le = chk.eq(j).attr('level');
    //         if (chk.eq(num).prop("checked")) {
    //
    //             if (le > level_bottom) {
    //                 chk.eq(j).prop("checked", true);
    //             }
    //             else if (le == level_bottom) {
    //                 break;
    //             }
    //         } else {
    //             if (le > level_bottom) {
    //                 chk.eq(j).prop("checked", false);
    //             } else if (le == level_bottom) {
    //                 break;
    //             }
    //         }
    //     }
    // }
</script>
</body>
</html>